<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!--引入jQuery类库-->
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
    <!--引入jQuery-Cookie插件CDN-->
    <script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
    <style>
        h1 {
            text-align: center;
        }
        #box{
            margin: 0px auto;
            border: 1px solid #ccc;
            border-radius: 5px;
            width: 280px;
            padding: 20px;
        }
    </style>
</head>
<body>
<h1>登录成功</h1>
<hr>

<div id="box">
    欢迎您：<span style="color:red;" id="loginSuccessUsername"></span>
</div>

<script>

    let loginUser = {
        "username": "",
        "password": ""
    };

    $("#loginSuccessUsername").text(loginUser.username);

    if(window.localStorage.getItem("loginSuccessUser")!=null){
        //字符串转换json对象
        loginUser = JSON.parse(localStorage.getItem("loginSuccessUser"));
        $("#loginSuccessUsername").text(loginUser.username);
    }

    /*尝试获取一下登录成功的用户名和密码*/
    let cookie_username = $.cookie('loginUsername.www.simoniu.com');
    let cookie_password = $.cookie('loginPassword.www.simoniu.com');
    console.log("cookie里保存的用户名是："+cookie_username);
    console.log("cookie里保存的密码是："+cookie_password);

</script>
</body>
</html>
